package edu.qqcui.study;

import edu.qqcui.study.bean.Person;
import edu.qqcui.study.config.MainConfig;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * 主测试类
 *
 * @author cuiqingqiang
 * @version 1.0
 * @date 2021-06-26 10:32
 **/
public class MainTest {

	public static void main(String[] args) {
//		ApplicationContext applicationContext = new ClassPathXmlApplicationContext("beans.xml");
//
//		Person person = (Person) applicationContext.getBean("person");
//
//		System.out.println(person);


		ApplicationContext applicationContext = new AnnotationConfigApplicationContext(MainConfig.class);

		Person person = applicationContext.getBean(Person.class);
		System.out.println(person);

		String[] names = applicationContext.getBeanNamesForType(Person.class);
		for (String name : names) {
			System.out.println(name);
		}
	}
}
